<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-CN">
<head>
<link rel="stylesheet" href="<%=path%>/css/manager/banner.css">
<link rel="stylesheet" href="<%=path%>/css/page.css">
<script type="text/javascript"
	src="<%=path%>/js/manager/jquery-1.8.2.js"></script>
<script type="text/javascript" src="<%=path%>/js/page.js"></script>
<title>Banner管理页</title>
</head>
<body>
	<!--
        	作者：offline
        	时间：2016-12-22
        	描述：论坛学人管理内容头部
        -->
	<div class="bbs_mist_div1">Banner管理</div>
	<div class="news_div2">
		<form action="banlist.htm" id="sform" method="post">
			<input class="news_div2_in1" type="text" placeholder="Banner名称"
				name="condition" id="condition" value="${banner.condition}" /> <input
				class="news_div2_in2" type="button" type="submit" value="查找"
				onclick="return submitCheck()" /> <input type="hidden"
				id="pageIndex" name="pageIndex" value="${banner.pageInfo.pageIndex}" />
			<input type="hidden" id="pageSize" name="pageSize"
				value="${banner.pageInfo.pageSize}" /> <input type="hidden"
				id="markManage" name="markManage" value="0" /> <input type="hidden"
				id="banId" name="banId" value="0" />
		</form>
	</div>
	<div class="bbs_mist_div2">
		<input class="bbs_mist_div2_in1" type="button" onclick="manage(1,0)" />
		<div class="bbs_mist_div2_div1">
			<div class="bbs_mist_div2_div1_div1">排序</div>
			<div class="bbs_mist_div2_div1_div2">banner照片</div>
			<div class="bbs_mist_div2_div1_div6">banner名称</div>
			<div class="bbs_mist_div2_div1_div3">状态</div>
			<div class="bbs_mist_div2_div1_div4">上线时间</div>
			<div class="bbs_mist_div2_div1_div5">操作</div>
		</div>
		<div class="bbs_mist_div2_div2">
			<c:forEach items="${list}" var="banners">
				<c:if test="${banners.banStatus==1}">
					<div class="bbs_mist_div2_div2_div1">
						<div class="bbs_mist_div2_div2_div1_div1">${banners.banOrder}</div>
						<div class="bbs_mist_div2_div2_div1_div2">
							<img src="/upload/images/banner/${banners.banImg}" />
						</div>
						<div class="bbs_mist_div2_div2_div1_div6">
							<a href="javascript: manage(3,'${banners.banId}')">${banners.banName}</a>
						</div>
						<div class="bbs_mist_div2_div2_div1_div3">
							<c:if test="${banners.banStatus==1}">展示中</c:if>
							<c:if test="${banners.banStatus==2}">已下线</c:if>
						</div>
						<div class="bbs_mist_div2_div2_div1_div4">
							<fmt:formatDate value="${banners.banAddtime}"
								pattern="yyyy-MM-dd HH:mm:ss" />
						</div>
						<div class="bbs_mist_div2_div2_div1_div5">
							<a href="javascript: manage(3,'${banners.banId}')">查看</a> <a
								href="javascript: manage(2,'${banners.banId}')">编辑</a> <a
								href="javascript: manage(4,'${banners.banId}')">删除</a>
							<c:if test="${banners.banStatus==1}">
								<a href="javascript: manage(5,'${banners.banId}')">取消展示</a>
							</c:if>
							<c:if test="${banners.banStatus==2}">
								<a href="javascript: manage(6,'${banners.banId}')">展示</a>
							</c:if>
						</div>
					</div>
				</c:if>
			</c:forEach>
			<c:forEach items="${list}" var="banners2">
				<c:if test="${banners2.banStatus==2}">
					<div class="bbs_mist_div2_div2_div1">
						<div class="bbs_mist_div2_div2_div1_div1">0</div>
						<div class="bbs_mist_div2_div2_div1_div2">
							<img src="upload/images/banner/${banners2.banImg}" />
						</div>
						<div class="bbs_mist_div2_div2_div1_div6">
							<a href="javascript: manage(3,'${banners2.banId}')">${banners2.banName}</a>
						</div>
						<div class="bbs_mist_div2_div2_div1_div3">
							<c:if test="${banners2.banStatus==1}">展示中</c:if>
							<c:if test="${banners2.banStatus==2}">已下线</c:if>
						</div>
						<div class="bbs_mist_div2_div2_div1_div4">
							<fmt:formatDate value="${banners2.banAddtime}"
								pattern="yyyy-MM-dd HH:mm:ss" />
						</div>
						<div class="bbs_mist_div2_div2_div1_div5">
							<a href="javascript: manage(3,'${banners2.banId}')">查看</a> <a
								href="javascript: manage(2,'${banners2.banId}')">编辑</a> <a
								href="javascript: manage(4,'${banners2.banId}')">删除</a>
							<c:if test="${banners2.banStatus==1}">
								<a href="javascript: manage(5,'${banners2.banId}')">取消展示</a>
							</c:if>
							<c:if test="${banners2.banStatus==2}">
								<a href="javascript: manage(6,'${banners2.banId}')">展示</a>
							</c:if>
						</div>
					</div>
				</c:if>
			</c:forEach>
		</div>
		<div class="bbs_mist_div2_div3">
			<select onchange="setPageSize()" id="pageSize_sel">
				<option
					<c:if test="${banner.pageInfo.pageSize==10}">selected="selected"</c:if>>10</option>
				<option
					<c:if test="${banner.pageInfo.pageSize==15}">selected="selected"</c:if>>15</option>
				<option
					<c:if test="${banner.pageInfo.pageSize==20}">selected="selected"</c:if>>20</option>
			</select> <span>/每页，共${banner.pageInfo.totalRec}条记录</span>
		</div>
		<div class="page">
			<!-- 分页 -->
			<c:set value="${banner.pageInfo}" var="pageInfo"></c:set>
			<%@include file="../template/pageTemplate.jsp"%>
		</div>
	</div>
</body>
<script type="text/javascript">
	//提交验证
	function submitCheck() {
		//1.搜索框去掉前后空格
		var condition = $.trim($("#condition").val());
		$("#condition").val(condition);
		return true;
	}
	//操作：type:1添加；2编辑；3查看；4删除
	function manage(type, id) {
		$("#markManage").val(type);
		$("#banId").val(id);
		$("#sform").attr("action", "tobanmanage.htm");
		$("#pageIndex").attr("name","pageInfo.pageIndex");  
		$("#pageSize").attr("name","pageInfo.pageSize");  
		if (type == 4) {
			if (window.confirm("确定要删除该条理事动态吗？")) {
				$("#sform").attr("action", "banmanage.htm");
			} else {
				return;
			}
		}
		if (type == 5 || type == 6) {
			$("#sform").attr("action", "banmanage.htm");
		}
		$("#sform").submit();

	}
</script>
</html>

